import React from 'react';
import { Popconfirm as AntdPopconfirm } from 'antd';
import type { PopconfirmProps as AntdPopconfirmProps } from 'antd';
import { createStyles } from 'antd-style';

export interface PopconfirmProps extends AntdPopconfirmProps {
  /**
   * @description 自定义样式类名
   */
  customClassName?: string;
}

const useStyles = createStyles(({ token, css }) => ({
  popconfirm: css`
    z-index: ${token.zIndexPopupBase};
  `,
}));

const PopconfirmComponent: React.FC<PopconfirmProps> = ({ customClassName, className, ...restProps }) => {
  const { styles, cx } = useStyles();
  
  const popconfirmClassName = cx(
    className,
    customClassName,
    styles.popconfirm
  );

  return <AntdPopconfirm className={popconfirmClassName} {...restProps} />;
};

const Popconfirm = Object.assign(PopconfirmComponent, {
  _InternalPanelDoNotUseOrYouWillBeFired: (AntdPopconfirm as any)._InternalPanelDoNotUseOrYouWillBeFired,
});

export { Popconfirm };
export default Popconfirm;

